package com.java.netty.nio.netty.inboundhandlerandoutboundhandler;

import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.socket.SocketChannel;

/**
 * @Author: Dgg
 * @Date: 2022/1/23 17:43
 */
public class MyClientInitializer extends ChannelInitializer<SocketChannel> {
	@Override
	protected void initChannel(SocketChannel ch) throws Exception {
		ChannelPipeline pipeline = ch.pipeline();

		//计入一个出站的handler，对数据进行编码
		pipeline.addLast(new MyLongToByteEncoder());
		//入站 解码
		pipeline.addLast(new MyByteToLongDecoder());
		//加入自定以handler，处理业务逻辑
		pipeline.addLast(new MyClinetHandler());


	}
}
